home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlComboGetLBText.au3 < prev    next >
Text File  |  2007-09-08  |  1KB  |  39 lines

  1. #include <GuiConstants.au3>
  2. #include <GuiCombo.au3>
  3.  
  4. opt('MustDeclareVars', 1)
  5.  
  6. Dim $Combo, $Btn_Exit, $Status, $msg, $Btn_Get, $Input_item
  7.  
  8. GUICreate("ComboBox Get LB Text", 392, 254)
  9.  
  10. $Combo = GUICtrlCreateCombo("", 70, 10, 270, 120)
  11. GUICtrlSetData($Combo, "AutoIt|v3|is|freeware|BASIC-like|scripting|language|designed|for|automating|the Windows GUI.")
  12.  
  13. GUICtrlCreateLabel("Enter index number of item:", 65, 112, 130, 20, $SS_RIGHT)
  14. $Input_item = GUICtrlCreateInput("0", 200, 110, 50, 20, $ES_NUMBER)
  15. GUICtrlSetLimit($Input_item, 2)
  16.  
  17. $Btn_Get = GUICtrlCreateButton("Get Text", 150, 140, 90, 30)
  18. $Btn_Exit = GUICtrlCreateButton("Exit", 150, 180, 90, 30)
  19. $Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
  20. GUICtrlSetData($Status, "Items: " & _GUICtrlComboGetCount ($Combo))
  21.  
  22. GUISetState()
  23. While 1
  24.    $msg = GUIGetMsg()
  25.    Select
  26.       Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
  27.          ExitLoop
  28.       Case $msg = $Btn_Get
  29.          Local $s_text
  30.          Local $i_count = _GUICtrlComboGetLBText ($Combo, Int(GUICtrlRead($Input_item)), $s_text)
  31.          If ($i_count == $CB_ERR) Then
  32.             GUICtrlSetData($Status, "Invalid Index: " & GUICtrlRead($Input_item))
  33.          Else
  34.             GUICtrlSetData($Status, "Len: " & $i_count & ", Index: " & GUICtrlRead($Input_item) & " = " & $s_text)
  35.          EndIf
  36.    EndSelect
  37. WEnd
  38. Exit
  39.